[2025-09-06] WebHacking.kr 1์ผ์ฐจ

๐Ÿฆฅ ๋ณธ๋ฌธ

Challenge 1

<?php
  include "../../config.php";
  if($_GET['view-source'] == 1){ view_source(); }
  if(!$_COOKIE['user_lv']){
    SetCookie("user_lv","1",time()+86400*30,"/challenge/web-01/");
    echo("<meta http-equiv=refresh content=0>");
  }
?>
<html>
<head>
<title>Challenge 1</title>
</head>
<body bgcolor=black>
<center>
<br><br><br><br><br>
<font color=white>
---------------------<br>
<?php
  if(!is_numeric($_COOKIE['user_lv'])) $_COOKIE['user_lv']=1;
  if($_COOKIE['user_lv']>=4) $_COOKIE['user_lv']=1;
  if($_COOKIE['user_lv']>3) solve(1);
  echo "<br>level : {$_COOKIE['user_lv']}";
?>
<br>
<a href=./?view-source=1>view-source</a>
</body>
</html>

SetCookie() : user_lv ๊ฐ’์„ 1 ๋กœ ์ง€์ •. ๋งŒ๋ฃŒ ๊ธฐ๊ฐ„์€ ํ•œ๋‹ฌ. /challenge/web-01 ๊ฒฝ๋กœ๋กœ ์˜จ ๊ฒƒ๋งŒ ์…‹ํŒ…

ํ’€์ด ๊ณผ์ •

user_lv ์˜ ๊ฐ’์ด 3๋ณด๋‹ค ํฌ๊ณ  4๋ณด๋‹ค ์ž‘์œผ๋ฉด solve. ์ฟ ํ‚ค์—์„œ ํ•ด๋‹น ๊ฐ’์„ 3.5๋กœ ์ง€์ •.

Challenge 15

image.png

alert() ์ดํ›„์—๋Š” webhacking.kr๋กœ ๋ฆฌ๋””๋ ‰์…˜ ๋œ๋‹ค. ์ฝ”๋“œ๋ฅผ ๋ณด๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ•ด๋‹น ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ ๋ชปํ•˜๊ฒŒ ๋ง‰์•„์•ผ ํ•œ๋‹ค.

ํ’€์ด ๊ณผ์ •

ํฌ๋กฌ์—์„œ ์„ค์ • > ๊ฐœ์ธ ์ •๋ณด ๋ณดํ˜ธ > ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํƒญ์—์„œ ํ•ด๋‹น ์‚ฌ์ดํŠธ์˜ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ถŒํ•œ์„ ํ•ด์ œํ•˜๋ฉด ๋นˆ ํŽ˜์ด์ง€์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ฝ”๋“œ๊ฐ€ ๋‚˜์˜จ๋‹ค

<script>
  alert("Access_Denied");
  location.href='/';
  document.write("<a href=?getFlag>[Get Flag]</a>");
</script>

ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ getFlag๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค.

Challenge 26

<?php
  include "../../config.php";
  if($_GET['view_source']) view_source();
?><html>
<head>
<title>Challenge 26</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }    
a { color:lightgreen; }
</style>
</head>
<body>
<?php
  if(preg_match("/admin/",$_GET['id'])) { echo"no!"; exit(); }
  $_GET['id'] = urldecode($_GET['id']);
  if($_GET['id'] == "admin"){
    solve(26);
  }
?>
<br><br>
<a href=?view_source=1>view-source</a>
</body>
</html>

ํ•ด๋‹น ์ฝ”๋“œ์—์„œ id ๊ฐ’์— admin์„ ์ž…๋ ฅํ•˜๋ฉด ์„ฑ๊ณต์ด์ง€๋งŒ ํ•„ํ„ฐ๋ง์ด ์žˆ๋‹ค.

ํ’€์ด ๊ณผ์ •

ํ•ด๋‹น ์ฝ”๋“œ์—์„œ ๋””์ฝ”๋”ฉ์„ ํ•œ ๋ฒˆ ๋” ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, admin์„ ํ•œ ๋ฒˆ ๋” ์ธ์ฝ”๋”ฉ์„ ํ•˜์—ฌ URL์— ๋ณด๋‚ด ์ฃผ๋ฉด ๋œ๋‹ค.

id=%2561%2564%256D%2569%256E

Challenge 16

<html>
<head>
<title>Challenge 16</title>
<body bgcolor=black onload=kk(1,1) onkeypress=mv(event.keyCode)>
<font color=silver id=c></font>
<font color=yellow size=100 style=position:relative id=star>*</font>
<script> 
document.body.innerHTML+="<font color=yellow id=aa style=position:relative;left:0;top:0>*</font>";
function mv(cd){
  kk(star.style.left-50,star.style.top-50);
  if(cd==100) star.style.left=parseInt(star.style.left+0,10)+50+"px";
  if(cd==97) star.style.left=parseInt(star.style.left+0,10)-50+"px";
  if(cd==119) star.style.top=parseInt(star.style.top+0,10)-50+"px";
  if(cd==115) star.style.top=parseInt(star.style.top+0,10)+50+"px";
  if(cd==124) location.href=String.fromCharCode(cd)+".php"; // do it!
}
function kk(x,y){
  rndc=Math.floor(Math.random()*9000000);
  document.body.innerHTML+="<font color=#"+rndc+" id=aa style=position:relative;left:"+x+";top:"+y+" onmouseover=this.innerHTML=''>*</font>";
}
</script>
</body>
</html>

ํ•ด๋‹น ์ฝ”๋“œ๋Š” evnet.keyCode์˜ ๊ฐ’์— ๋”ฐ๋ผ ๋ณ€ํ•˜๋Š” ํŽ˜์ด์ง€๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค

ํ’€์ด๊ณผ์ •

124์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ž์—ด์€ | ์ด๊ณ  |.php ๋ฅผ ์ ‘์†ํ•˜๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค.

Categories:

Updated:

Leave a comment